<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateNovelsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('novels', function (Blueprint $table) {
            $table->id();
            $table->timestamps();
            $table->string('novel_name');
            $table->string('author_name');
            $table->integer('author_id');
            $table->string('tag_name');
            $table->integer('tag_id');
            $table->string('cover_url');
            $table->text('intro')->comment('简介');
            $table->char('is_done', 1)->default('N')->comment('Y/N 是否完结');
            $table->integer('words_num')->default(0)->comment('字数');
            $table->integer('chapter_num')->default(0)->comment('章节数');
            $table->char('is_hide')->default('N')->comment('是否隐藏');
            $table->softDeletes();
            $table->bigInteger('touch_num')->default(0)->comment('点击数');
            $table->integer('coupon')->default(0)->comment('书券');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('novels');
    }
}
